package it.polimi.sartori_daniello_picca.meteocal.entity;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author Ale
 */
@Entity
@Table
@NamedQueries({
    @NamedQuery (name= "Contains.findByAll", query= "SELECT c FROM Contains c WHERE c.event= :event AND c.calendarowner= :calendarowner"),
    @NamedQuery(name = "Contains.findByCalendarOwner", query = "SELECT c FROM Contains c WHERE c.calendarowner= :calendarowner"),
    @NamedQuery(name = "Calendar.findByEvent", query = "SELECT c FROM Contains c WHERE c.event = :event"),
})
public class Contains implements Serializable {
    
    public static final String findByAll = "Event.findByAll";
    public static final String findByCalendarOwner = "Contains.findByCalendarOwner";
    public static final String findByEvent = "Contains.findByEvent";
    
    @Id
    @OneToOne
    private Users calendarowner;

    @Id
    @OneToOne
    private Event event;

    public Contains(){
    }
    
    public Contains(Users c, Event e){
        calendarowner = c;
        event = e;
    }
}
